Validate the handoff manifest against a JSON Schema and scaffold it on init - #2
Open
aswasif007 wants to merge 4 commits into
Open
Validate the handoff manifest against a JSON Schema and scaffold it on init#2aswasif007 wants to merge 4 commits into
aswasif007 wants to merge 4 commits into
Conversation
Add manifest.schema.ts — a JSON Schema covering integration identity, documentation, plugin runtime, the runtime-config fields (types, patterns, enums, autogen/note), telemetry, and release — and validate the manifest against it with Ajv, replacing the hand-rolled presence checks. Rule 3 also rejects unfilled init placeholders and cross-checks the config keys the plugin declares (Config::REQUIRED_FIELDS / SENSITIVE_FIELDS) against runtime_config.fields. Renames the manifest convention to a8c-manifest.yaml.
init fills the manifest fields it can derive from the integration name (summary, release.changelog), seeds the partner-only fields it cannot (support contact, documentation URLs) with a REPLACE_ME placeholder so validate fails until they are filled, and leaves the scaffold as a plain directory rather than initializing a git repo.
aswasif007
force-pushed
the
improve/manifest-schema-validation
branch
from
July 28, 2026 13:58
74a0e24 to
1a2267d
Compare
aswasif007
marked this pull request as ready for review
July 28, 2026 13:58
The Rule 3 config cross-check read the plugin's config contract with a substring regex over the raw, concatenated PHP source. A REQUIRED_FIELDS or SENSITIVE_FIELDS mention inside a comment, or an unrelated constant whose name merely ended in one of those, was taken as the real contract and a conformant integration was reported non-conformant. Strip PHP comments first, anchor on a real `const <NAME>` declaration, and accept single- or double-quoted keys. Also match the manifest placeholder as a whole token so a value that only embeds REPLACE_ME isn't flagged.
scaffold.ts kept a private copy of the manifest filenames that had to stay identical to the exported list in validate/manifest.ts or init and validate would disagree on what a manifest is called. Import the one source of truth instead.
andrea-sdl
reviewed
Jul 28, 2026
| */ | ||
| function configFieldMismatches( ctx: Context, fields: Map< string, ManifestField > ): string[] { | ||
| const source = stripPhpComments( ctx.phpSource ); | ||
| const required = phpConstStringArray( source, 'REQUIRED_FIELDS' ); |
There was a problem hiding this comment.
This is minor, I think it's ok to not fix it for now.
Since we're concatenating the files, if we have this two files and the first one is loaded first, then we will miss the second required field (webhook_secret)
// inc/aaa-flags.php — unrelated class, scanned first
final class Flags {
public const REQUIRED_FIELDS = [ 'api_base_url' ];
}
// inc/class-config.php — the real config contract
final class Config {
public const CONSTANT_NAME = 'VIP_ACME_WIDGET_CONFIG';
public const REQUIRED_FIELDS = [
'api_base_url',
'webhook_secret',
];
}
But I think it's fine. What we could probably shift is the way we communicate the validation. We're not actually 100% sure of the fields matching, so we could probably frame it slightly differently when the CLI returns the output/validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds schema-driven validation of the handoff manifest to the
a8c-integrationCLI, and makesinitproduce a ready-to-fill manifest. The manifest (a8c-manifest.yaml) now has a formal JSON Schema as its single source of truth;validatechecks against it, and additionally rejects unfilled placeholders.Testing steps
pnpm install && pnpm build && pnpm linkcd .. && a8c-integration inita8c-integration validate. You should see some errors.foo: bar. Run the validate command again. You should see error again.